package com.nh.reception.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nh.common.pojo.Log;
import com.nh.reception.service.ReceptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: LaoCao
 * @Date: 2023/3/17 21:31
 * @Version: 1.0
 **/
@Api(tags = "日志接待服务")
@RestController
@RequestMapping("/admin/reception")
public class ReceptionController {

    @Resource
    private ReceptionService receptionService;

    @ApiOperation("根据条件进行分页查询已分析的日志信息")
    @GetMapping("/find/log/{page}/{size}")
    public IPage<Log> findPageLog(
            @PathVariable Integer page,
            @PathVariable Integer size,
            @ApiParam(value = "日期格式：yyyy-MM-dd") @RequestParam(required = false) String date){
        IPage<Log> iPage = new Page<>(page,size);
        iPage = receptionService.findPageLog(iPage,date);
        return iPage;
    }

    @ApiOperation("获取指定日志id之后的所有已经分析过的数据")
    @GetMapping("/find/all/log/id")
    public List<Long> findLogIdList(@RequestParam("logId") Long logId,
                                    @RequestParam("date") String date){
        return receptionService.findLogIdList(logId,date);
    }

}
